﻿@{
    ViewBag.Title = "OutcomReserationView";
}
@using WeiXinWeb.Models
@model OutConsignationDetail


<style type="text/css">
    .custom-corners .ui-bar {
        -webkit-border-top-left-radius: inherit;
        border-top-left-radius: inherit;
        -webkit-border-top-right-radius: inherit;
        border-top-right-radius: inherit;
    }

    .custom-corners .ui-body {
        border-top-width: 0;
        -webkit-border-bottom-left-radius: inherit;
        border-bottom-left-radius: inherit;
        -webkit-border-bottom-right-radius: inherit;
        border-bottom-right-radius: inherit;
    }

</style>
<script type="text/javascript">
    $(function () {
        var mm = message();
        $("#res").click(function () {
            var cc = $("#carnumber option:selected").text();
            var price = $("#price");
            if (cc == "") {
                mm.update("没有选择车辆！").show("")
                return false;
            }
            if ($.trim(price.val()) == "") {
                mm.update("请输入运费报价！").show("")
                price.focus()
                return false;
            }
            var sel = $("#last").find("select")
            var cc = $(sel[0]).val() + " " + $(sel[1]).val();
            cc = cc.substring(3, cc.length); //时间

            var cntnum = $("#cnttype").val() == "大柜" ? $("#cntone").val() : $("#cntone").val() + "/" + $("#cnttwo").val();


            parm = $("#subform").serialize() + "&LastDt=" + cc+"&cntnum="+cntnum;

            $.post("/Reservation/SaveExport", parm, function (data) {
                if (data != null) {
                    if (data == "") {
                        $("#popupDialog").popup("open");
                    }
                    else {
                        mm.update(data).show();
                    }
                }

            });

        });

        $("#cnttype").change(function () {
            if ($(this).val() == "小柜") {
                $("#ctwo").css({ "display": "block" });
            }
            else {
                $("#ctwo").css({ "display": "none" });
            }

        });
    });

</script>

<div data-role="page">
    <div data-role="header" data-theme="b">
        <a href="#" data-rel="back" data-icon="back" data-theme="e">返回</a>
        <h1>预约操作</h1>
    </div>
    <div data-role="content">
        <div class="ui-corner-all custom-corners">
            <div class="ui-bar ui-bar-a">
                <h3>出口委托</h3>
            </div>
            <div class="ui-body ui-body-a">
                <p>门点:@Model.Address</p>
                <p>装箱时限:@Model.outconsig.TakeCntTime</p>
                <p>运输日期:@Model.outconsig.PlanDt.ToShortDateString()</p>
                <form id="subform" method="post">
                    <label for="car">选择车辆:</label>
                    <select name="carnumber" id="carnumber">
                        @{
                            var list = (List<Truck>)ViewBag.vehicle;
                            if (list.Count > 0)
                            {
                                foreach (var item in list)
                                {
                                    <option value="@item.Id">@item.TruckNumber</option>
                                }
                            }
                            else
                            {
                                <option></option>
                            }
                        }
                    </select>
                    <label for="ownerPrice">运费报价:</label>
                    <input type="number" id="price" name="ownerPrice" />

                    <label for="ownerPrice">拖车最晚抵达门点时间:</label>
                    <div id="last" >

                            <select style="white-space: normal">
                                <option style="white-space: normal">今天:@Html.Raw(DateTime.Now.ToShortDateString())</option>
                                <option style="white-space: normal">明天:@Html.Raw(DateTime.Now.AddDays(1).ToShortDateString())</option>
                            </select>
          
                            <select>
                                @{
                                    for (int i = 0; i < 24; i++)
                                    {
                                        var hours = "";
                                        if (i < 10)
                                        {
                                            hours = "0" + i;
                                        }
                                        else
                                        {
                                            hours = i.ToString();
                                        }
                                        <option>@(hours + ":00")</option>
                                        <option>@(hours + ":30")</option>
                                    }
                                }
                            </select>

                    </div>

                    <div>
                        箱型:&nbsp;&nbsp;<select id="cnttype" data-role="flipswitch" data-mini="true">
                            <option>大柜</option>
                            <option>小柜</option>
                        </select>
                    </div>

                        <div class="ui-grid-a">
                            <div class="ui-block-a" style=" width: 18%; height: 54px; line-height: 54px; text-align: center;">
                                箱号1:</div>
                            <div class="ui-block-b" style="width:82%">
                                <input type="text" id="cntone" />
                            </div>
                        </div>

                    <div class="ui-grid-a" style="display:none" id="ctwo">
                        <div class="ui-block-a" style=" width: 18%; height: 54px; line-height: 54px; text-align: center;">
                            箱号2:</div>
                        <div class="ui-block-b" style="width:82%">
                            <input type="text" id="cnttwo" />
                        </div>
                    </div>

                    <input type="hidden" name="orderID" value="@Model.Id" />
                    <a href="#" id="res"  class="ui-btn-corner-all ui-btn ui-btn-icon-left ui-icon-comment" type="button">预约</a>
                </form>
            </div>
            <div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width:400px;">
                <div data-role="header" data-theme="a">
                    <h1>提示</h1>
                </div>
                <div role="main" class="ui-content">
                    <h3 class="ui-title" id="alert">预约已提交，工作人员会尽快回复你。</h3>
                    <a href="/Common/Dialog" target="_self" class="ui-btn ui-corner-all ui-shadow ui-btn-a">确定</a>
                </div>
            </div>
        </div>
    </div>
</div>
